package top.jolyoulu.codegenweb.service.dal.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.jolyoulu.codegenweb.dao.GenTemplateFileMapper;
import top.jolyoulu.codegenweb.entity.po.GenTemplateFile;
import top.jolyoulu.codegenweb.service.dal.GenTemplateFileService;

import java.util.List;

/**
 * @Author: JolyouLu
 * @Date: 2023/4/8 14:41
 * @Description
 */
@Slf4j
@Service
public class GenTemplateFileServiceImpl extends ServiceImpl<GenTemplateFileMapper, GenTemplateFile> implements GenTemplateFileService {

    @Autowired
    private GenTemplateFileMapper genTemplateFileMapper;

    @Override
    public List<GenTemplateFile> selectByGroupId(String groupId) {
        LambdaQueryWrapper<GenTemplateFile> ew = new LambdaQueryWrapper<>();
        ew.eq(GenTemplateFile::getGroupId,groupId);
        return genTemplateFileMapper.selectList(ew);
    }

    @Override
    public boolean removeByGroupId(String id) {
        LambdaQueryWrapper<GenTemplateFile> ew = new LambdaQueryWrapper<>();
        ew.eq(GenTemplateFile::getGroupId,id);
        return genTemplateFileMapper.delete(ew) > 0;
    }
}
